<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function showHidden(id){
		var obj = document.getElementById(id);
		if(obj.style.display == "none"){
			document.getElementById(id).style.display = "block";
			document.getElementById("img"+id).src = "./images/nolines_minus.gif";
		}else{
			document.getElementById(id).style.display = "none";
			document.getElementById("img"+id).src = "./images/nolines_plus.gif";
		}
	}
	
	function back(){
		var customerId = "<c:out value='${customerId}'/>";
		var sign = "<c:out value='${sign}'/>";
		parent.window.location.href = "./customerManage.do?action=customerDetail&customerId="+customerId+"&sign="+sign;
		window.location.target = "main";
	}
	
	function viewLinkmanUpdateHistory(id){
		var customerId = "<c:out value='${customerId}'/>";
		var sign = "<c:out value='${sign}'/>";
		var linkmanId = "<c:out value='${linkmanId}'/>";
		document.linkmanUpdateHistoryDetailForm.action = "./linkman.do?action=linkmanUpdateHistoryDetail&id="+linkmanId+"&customerId="+customerId+"&sign="+sign+"&uId="+id;
		document.linkmanUpdateHistoryDetailForm.target = "linkmanHistoryFrame";
		document.linkmanUpdateHistoryDetailForm.submit();
	}
	
	function restoreLinkmanInfo(){
		var customerId = "<c:out value='${customerId}'/>";
		var sign = "<c:out value='${sign}'/>";
		var linkmanId = "<c:out value='${linkmanId}'/>";
		
		var ids = document.getElementsByName("uId");
		var flag = 0;
		for(var i = 0; i < ids.length; i++){
			if(ids[i].checked)flag = flag + 1;
		}
		
		if(flag > 0){
			document.linkmanUpdateHistoryDetailForm.action = "./linkman.do?action=restoreLinkmanInfo&id="+linkmanId+"&customerId="+customerId+"&sign="+sign;
			document.linkmanUpdateHistoryDetailForm.target = "main";
			document.linkmanUpdateHistoryDetailForm.submit();
		}else{
			alert("<fmt:message key='common.message.wRestore'/>");
		}
	}
	
-->
</script>
</head>
<body>
<form name="linkmanUpdateHistoryDetailForm" action="" method="post">
	<table class="table_title2">
		<tr>
			<td class="title_lab">
				<fmt:message key='customer.title.linkmanHistory'/>
			</td>
		</tr>
		<tr>
			<td align="center" valign="bottom">
				<c:if test="${isRestoreCustomer == 1}">
				<button class="btn_submit" onclick="restoreLinkmanInfo()" hidefocus="true"><fmt:message key='common.button.restore'/></button>&nbsp;&nbsp;
				</c:if>
				<button class="btn_back" onclick="back()" hidefocus="true">取消并返回</button>
			</td>
		</tr>
		<tr><td height="2"></td></tr>
		<tr>
			<td>
				<table class="table_style">
					<tr>
						<td class="title" width="8"></td>
						<td class="title" width="30"><fmt:message key='common.lable.checkbox'/></td>
						<td class="title" width="12%"><fmt:message key='customer.lable.updateRecord'/></td>
						<td class="title" width="12%"/><fmt:message key='linkman.lable.name'/></td>
						<td class="title" width="12%"><fmt:message key='linkman.lable.officePhone'/></td>
						<td class="title"><fmt:message key='linkman.lable.mobile'/></td>
						<td class="title"><fmt:message key='linkman.lable.email'/></td>
						<td class="title" width="12%"><fmt:message key='customer.lable.updatePerson'/></td>
						<td class="title" width="12%"><fmt:message key='customer.lable.updateDate'/></td>
					</tr>
					<%
						int i = 1; 
					%>
					<c:forEach var="linkman" items="${linkmans}">
					<tr onmouseover="onmousemoveChange(this,'img${linkman.id}')" onmouseout="onmouseoutChange(this,'img${linkman.id}')">
						<td height="16" width="8" align="right"><img id="img${linkman.id}" src="./images/table_sign2.bmp"></td>
						<td><input id="uId" name="uId" type="radio" value="${linkman.id}"/></td>
						<c:choose>
							<c:when test="${linkman.isPrimitive == 1}">
								<td style="color: red;"><fmt:message key='customer.lable.primitive'/></td>
							</c:when>
							<c:otherwise>
								<td><fmt:message key='customer.lable.updateRecord'/><%=i%><%i ++;%></td>
							</c:otherwise>
						</c:choose>
						<td><a href="javascript:viewLinkmanUpdateHistory('${linkman.id}');">${linkman.linkmanName}</a></td>
						<td>${linkman.officePhone}</td>
						<td>${linkman.mobile}</td>
						<td>${linkman.email}</td>
						<td>${linkman.updatePerson}</td>
						<td><fmt:formatDate value="${linkman.updateDate}" pattern="yyyy-MM-dd"/></td>
					</tr>
					</c:forEach>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<!-- page -->
				<table class="table_page">
					<tr>
						<td class="a_tools">
							${totalRows}&nbsp;<fmt:message key='common.page.totalRow'/>&nbsp;&nbsp;
							<fmt:message key='common.page.totalPage'/>&nbsp;${totalPages}&nbsp;<fmt:message key='common.page'/>&nbsp;&nbsp;
							<fmt:message key='common.page.current'/>&nbsp;${currentPage}&nbsp;<fmt:message key='common.page'/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<a href="./linkman.do?action=linkmanUpdateHistoryDetail&flag=1&id=${linkmanId}&customerId=${customerId}&sign=${sign}" target="linkmanHistoryFrame" hidefocus="true"><fmt:message key='common.page.first'/></a>&nbsp;&nbsp;
							<a href="./linkman.do?action=linkmanUpdateHistoryDetail&flag=2&id=${linkmanId}&customerId=${customerId}&sign=${sign}" target="linkmanHistoryFrame" hidefocus="true"><fmt:message key='common.page.previous'/></a>&nbsp;&nbsp;
							<a href="./linkman.do?action=linkmanUpdateHistoryDetail&flag=3&id=${linkmanId}&customerId=${customerId}&sign=${sign}" target="linkmanHistoryFrame" hidefocus="true"><fmt:message key='common.page.next'/></a>&nbsp;&nbsp;
							<a href="./linkman.do?action=linkmanUpdateHistoryDetail&flag=4&id=${linkmanId}&customerId=${customerId}&sign=${sign}" target="linkmanHistoryFrame" hidefocus="true"><fmt:message key='common.page.last'/></a>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<c:if test="${linkman != null}">
				<table id="tBaseInfo" class="table_add" style="display: block;">
					<tr>
						<td colspan="2" class="title_top"><fmt:message key='customer.lable.baseInfo'/></td>
					</tr>
					<tr>
						<td class="title"><!-- 客户名称 -->
							客户名称：
						</td>
						<td width="">${customer.customerName}</td>
					</tr>
					<tr>
						<td class="title"><!-- 姓名 -->
							<c:choose>
								<c:when test="${language == 2}">${records['21'].currentRecordEn}：</c:when>
								<c:otherwise>${records['21'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="">${linkman.linkmanName}</td>
					</tr>
					<tr>
						<td class="title" width=""><!-- 部门 -->
							<c:choose>
								<c:when test="${language == 2}">${records['22'].currentRecordEn}：</c:when>
								<c:otherwise>${records['22'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="">${linkman.linkmanDept}</td>
					</tr>
					<tr>
						<td class="title" width=""><!-- 职务 -->
							<c:choose>
								<c:when test="${language == 2}">${records['23'].currentRecordEn}：</c:when>
								<c:otherwise>${records['23'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="">${linkman.linkmanDuty}</td>
					</tr>
					<tr>
						<td class="title" width=""><!-- 角色 -->
							<c:choose>
								<c:when test="${language == 2}">${records['24'].currentRecordEn}：</c:when>
								<c:otherwise>${records['24'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="">
							<c:forEach var="range" items="${ranges['24']}">
								<c:if test='${linkman.itemRoleId == range.id}'>${range.rangeValue}</c:if>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<td class="title" width=""><!-- 手机 -->
							<c:choose>
								<c:when test="${language == 2}">${records['25'].currentRecordEn}：</c:when>
								<c:otherwise>${records['25'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="">${linkman.mobile}</td>
					</tr>
					<tr>
						<td class="title" width=""><!-- 办公电话 -->
							<c:choose>
								<c:when test="${language == 2}">${records['26'].currentRecordEn}：</c:when>
								<c:otherwise>${records['26'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="">${linkman.officePhone}</td>
					</tr>
					<tr>
						<td class="title" width=""><!-- 邮箱 -->
							<c:choose>
								<c:when test="${language == 2}">${records['27'].currentRecordEn}：</c:when>
								<c:otherwise>${records['27'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="">${linkman.email}</td>
					</tr>
					<tr>
						<td class="title"><!-- 备注 -->
							<c:choose>
								<c:when test="${language == 2}">${records['28'].currentRecordEn}：</c:when>
								<c:otherwise>${records['28'].currentRecord}：</c:otherwise>
							</c:choose>
						</td>
						<td width="" class="textarea_vdesc"><pre>${linkman.linkDesc}</pre></td>
					</tr>
				</table>
			
				<table class="table">
					<tr>
						<td class="title_info" onclick="showHidden('2')">
							<img id="img2" src="./images/nolines_minus.gif">
							<fmt:message key='customer.lable.moreInfo'/>
						</td>
					</tr>
					<tr id="2">
						<td>
							<table class="table_add">
								<c:if test="${records['29'].status == 1}">
								<tr>
									<td class="title"><!-- 性别 -->
										<c:choose>
											<c:when test="${language == 2}">${records['29'].currentRecordEn}：</c:when>
											<c:otherwise>${records['29'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['29']}">
											<c:if test='${linkman.sexId == range.id}'>${range.rangeValue}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['210'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 住宅电话 -->
										<c:choose>
											<c:when test="${language == 2}">${records['210'].currentRecordEn}：</c:when>
											<c:otherwise>${records['210'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.homePhone}</td>
								</tr>
								</c:if>
								<c:if test="${records['211'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 其他联系方式 -->
										<c:choose>
											<c:when test="${language == 2}">${records['211'].currentRecordEn}：</c:when>
											<c:otherwise>${records['211'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.otherContactWay}</td>
								</tr>
								</c:if>
								<c:if test="${records['212'].status == 1}">
								<tr>
									<td class="title" width=""><!-- MSN -->
										<c:choose>
											<c:when test="${language == 2}">${records['212'].currentRecordEn}：</c:when>
											<c:otherwise>${records['212'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.MSN}</td>
								</tr>
								</c:if>
								<c:if test="${records['213'].status == 1}">
								<tr>
									<td class="title" width=""><!-- QQ -->
										<c:choose>
											<c:when test="${language == 2}">${records['213'].currentRecordEn}：</c:when>
											<c:otherwise>${records['213'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.QQ}</td>
								</tr>
								</c:if>
								<c:if test="${records['214'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 个人主页 -->
										<c:choose>
											<c:when test="${language == 2}">${records['214'].currentRecordEn}：</c:when>
											<c:otherwise>${records['214'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.homePage}</td>
								</tr>
								</c:if>
								<c:if test="${records['215'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 年收入 -->
										<c:choose>
											<c:when test="${language == 2}">${records['215'].currentRecordEn}：</c:when>
											<c:otherwise>${records['215'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['215']}">
											<c:if test='${linkman.yearIncomeId == range.id}'>${range.rangeValue}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['216'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 职业 -->
										<c:choose>
											<c:when test="${language == 2}">${records['216'].currentRecordEn}：</c:when>
											<c:otherwise>${records['216'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['216']}">
											<c:if test='${linkman.jobId == range.id}'>${range.rangeValue}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['217'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 国家 -->
										<c:choose>
											<c:when test="${language == 2}">${records['217'].currentRecordEn}：</c:when>
											<c:otherwise>${records['217'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['217']}">
											<c:if test='${customer.countryId == range.id}'>${range.CName}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['218'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 省级 -->
										<c:choose>
											<c:when test="${language == 2}">${records['218'].currentRecordEn}：</c:when>
											<c:otherwise>${records['218'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['218']}">
											<c:if test='${customer.provinceId == range.id}'>${range.CName}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['219'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 市级 -->
										<c:choose>
											<c:when test="${language == 2}">${records['219'].currentRecordEn}：</c:when>
											<c:otherwise>${records['219'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['219']}">
											<c:if test='${customer.cityId == range.id}'>${range.CName}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['220'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 生日 -->
										<c:choose>
											<c:when test="${language == 2}">${records['220'].currentRecordEn}：</c:when>
											<c:otherwise>${records['220'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width=""><fmt:formatDate value='${linkman.birthday}' pattern='yyyy-MM-dd'/></td>
								</tr>
								</c:if>
								<c:if test="${records['221'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 喜好 -->
										<c:choose>
											<c:when test="${language == 2}">${records['221'].currentRecordEn}：</c:when>
											<c:otherwise>${records['221'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['221']}">
											<c:if test='${linkman.interestId == range.id}'>${range.rangeValue}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['222'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 是否结婚 -->
										<c:choose>
											<c:when test="${language == 2}">${records['222'].currentRecordEn}：</c:when>
											<c:otherwise>${records['222'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['222']}">
											<c:if test='${linkman.isMarryId == range.id}'>${range.rangeValue}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['223'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 自定义数字项1 -->
										<c:choose>
											<c:when test="${language == 2}">${records['223'].currentRecordEn}：</c:when>
											<c:otherwise>${records['223'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.customNumItem1}</td>
								</tr>
								</c:if>
								<c:if test="${records['224'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 自定义数字项2 -->
										<c:choose>
											<c:when test="${language == 2}">${records['224'].currentRecordEn}：</c:when>
											<c:otherwise>${records['224'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.customNumItem2}</td>
								</tr>
								</c:if>
								<c:if test="${records['225'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 自定义数字项3 -->
										<c:choose>
											<c:when test="${language == 2}">${records['225'].currentRecordEn}：</c:when>
											<c:otherwise>${records['225'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['225']}">
											<c:if test='${linkman.customNumItemId3 == range.id}'>${range.rangeValue}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
								<c:if test="${records['226'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 自定义项1 -->
										<c:choose>
											<c:when test="${language == 2}">${records['226'].currentRecordEn}：</c:when>
											<c:otherwise>${records['226'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.customItem1}</td>
								</tr>
								</c:if>
								<c:if test="${records['227'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 自定义项2 -->
										<c:choose>
											<c:when test="${language == 2}">${records['227'].currentRecordEn}：</c:when>
											<c:otherwise>${records['227'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">${linkman.customItem2}</td>
								</tr>
								</c:if>
								<c:if test="${records['228'].status == 1}">
								<tr>
									<td class="title" width=""><!-- 自定义项3 -->
										<c:choose>
											<c:when test="${language == 2}">${records['228'].currentRecordEn}：</c:when>
											<c:otherwise>${records['228'].currentRecord}：</c:otherwise>
										</c:choose>
									</td>
									<td width="">
										<c:forEach var="range" items="${ranges['228']}">
											<c:if test='${linkman.customItemId3 == range.id}'>${range.rangeValue}</c:if>
										</c:forEach>
									</td>
								</tr>
								</c:if>
							</table>
						</td>
					</tr>
				</table>
				</c:if>
			</td>
		</tr>
	</table>
</form>	
</body>
</html>